package com.cskaoyan.service;

import com.cskaoyan.bean.*;
import com.cskaoyan.bean.System;
import com.cskaoyan.mapper.SystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

@Service
public class ConfigurationServiceImpl implements ConfigurationService {

    @Autowired
    SystemMapper systemMapper;

    @Override
    public Map  selectConfigurationMallList() {
        List<String> strings = systemMapper.selectConfigurationMallList();
        HashMap<String, String> resultMap = new HashMap<>();
        resultMap.put("cskaoyanmall_mall_name",strings.get(0));
        resultMap.put("cskaoyanmall_mall_qq",strings.get(1));
        resultMap.put("cskaoyanmall_mall_phone",strings.get(2));
        resultMap.put("cskaoyanmall_mall_address",strings.get(3));
        return resultMap;

    }

    @Override
    public Integer updateConfigurationMallList(MallDataBean mallDataBean) {
        systemMapper.updateConfigurationMallList(mallDataBean);
        return null;
    }

    @Override
    public Map selectExpressConfigurationList() {
        List<String> strings = systemMapper.selectExpressConfigurationList();
        HashMap<String, String> resultMap = new HashMap<>();
        resultMap.put("cskaoyanmall_express_freight_min",strings.get(0));
        resultMap.put("cskaoyanmall_express_freight_value",strings.get(1));
        return resultMap;
    }

    @Override
    public Integer updateExpressConfigurationList(ConfigExpressVO configExpressVO) {
        systemMapper.updateExpressConfigurationList(configExpressVO);
        return null;
    }

    @Override
    public Map selectOrderConfigurationList() {
        List<String> strings = systemMapper.selectOrderConfigurationList();
        HashMap<String, String> resultMap = new HashMap<>();
        resultMap.put("cskaoyanmall_order_unpaid",strings.get(0));
        resultMap.put("cskaoyanmall_order_unconfirm",strings.get(1));
        resultMap.put("cskaoyanmall_order_comment",strings.get(2));
        return resultMap;
    }

    @Override
    public Integer updateOrderConfigurationList(ConfigOrderVO configOrderVO) {
        systemMapper.updateOrderConfigurationList(configOrderVO);
        return null;
    }

    @Override
    public Map selectWxConfigurationList() {
        List<String> strings = systemMapper.selectWxConfigurationList();
        HashMap<String, String> resultMap = new HashMap<>();
        resultMap.put("cskaoyanmall_wx_catlog_goods",strings.get(0));
        resultMap.put("cskaoyanmall_wx_share",strings.get(1));
        resultMap.put("cskaoyanmall_wx_index_brand",strings.get(2));
        resultMap.put("cskaoyanmall_wx_index_hot",strings.get(3));
        resultMap.put("cskaoyanmall_wx_index_new",strings.get(4));
        resultMap.put("cskaoyanmall_wx_index_topic",strings.get(5));
        resultMap.put("cskaoyanmall_wx_catlog_list",strings.get(6));
        return resultMap;
    }

    @Override
    public Integer updateWxConfigurationList(WxVO wxVO) {
        systemMapper.updateWxConfigurationList(wxVO);
        return null;
    }


}
